import java.util.HashMap;
import java.util.Scanner;

public class Demo3 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int q = scan.nextInt();

        int[] arr = new int[n];

        for (int i = 0; i < n; i++) {
            arr[i] = scan.nextInt();
        }

        long sum = 0;
        for (int i : arr) {
            sum += i;
        }

        for (int i = 0; i < q; i++) {
            int L = scan.nextInt();
            int R = scan.nextInt();

            int len = R - L + 1;
            if (len % 2 == 0) {
                sum -= len / 2;
            } else {
                sum = sum - len / 2 + R;
            }
        }

        System.out.println(sum);
        scan.close();
    }
}
